package com.powernode.feign.fallbackfactory;

import com.powernode.domain.Prod;
import com.powernode.feign.MemberProductFeign;
import com.powernode.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @create: 2024/7/24
 * @author: gyhe10
 * @description: 会员服务远程调用商品服务失败的降级处理
 **/

@Component
@Slf4j
public class MemberProductFeignFallbackFactory implements FallbackFactory<MemberProductFeign> {
    @Override
    public MemberProductFeign create(Throwable cause) {
        return new MemberProductFeign() {
            @Override
            public Result<List<Prod>> getProdListByIds(List<Long> prodIds) {
                log.error("会员服务远程调用商品服务失败：根据商品id集合查询商品对象集合，原因：", cause);
                return null;
            }
        };
    }
}
